// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import Vuex from 'vuex'
import VueRouter from 'vue-router' //载入路由
import routes from './router'
import store from './vuex/store';
import http from './api/api';
//import md5 from 'js-md5';

//百度地图
import BaiduMap from 'vue-baidu-map'
Vue.use(BaiduMap, {
	// ak 是在百度地图开发者平台申请的密钥 详见 http://lbsyun.baidu.com/apiconsole/key */
	ak: 'WeyluL4oN7y0PX8xjnE6E18Ymp20K1EM'
})

var FastClick = require('fastclick');
FastClick.attach(document.body);

//图片懒加载
import VueLazyload from 'vue-lazyload'
Vue.use(VueLazyload)
//rem
import 'lib-flexible/flexible';
//样式引入
import "swiper/dist/css/swiper.css";
//组件引入
import { Alert, Confirm, Toast, Loading } from 'wc-messagebox';
import 'wc-messagebox/style.css';
Vue.use(Alert);
Vue.use(Confirm);
Vue.use(Toast);
Vue.use(Loading)

//挂载全局
import './public/jsencrypt.js';
import publicMethod from './public/function';
import baseUrl from './public/url';
Vue.prototype.$publicMethod = publicMethod; //公共函数
Vue.prototype.$baseUrl = baseUrl;
Vue.prototype.$http = http; //ajax
//Vue.prototype.$md5 = md5; //md5

Vue.config.productionTip = false;
const router = new VueRouter({
	//	mode:'history',
	routes
})
/* eslint-disable no-new */
Vue.use(VueRouter);

// router.beforeEach((to, from, next) => {
// 	window.scrollTo(0, 0);
// 	if (store.getters.userinfo || store.getters.userinfo.length > 0) {
// 		if (to.path == '/login') {
// 			store.commit('USERINFO');
// 		} else {
// 			next();
// 		}
// 	} else {
// 		next();
// 	}
// });


new Vue({
	router,
	store,
	render: h => h(App),
	data: {
		eventHub: new Vue()
	}
}).$mount('#app');